package com.fenghongzhang.day005;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Main2Activity extends AppCompatActivity implements BlankFragment.MyListener{
    private LinearLayout ll;
    private TextView aText;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        ll = (LinearLayout) findViewById(R.id.ll);
        aText = (TextView) findViewById(R.id.a_text);

        FragmentManager supportFragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
        BlankFragment blankFragment = new BlankFragment();
        fragmentTransaction.add(R.id.ll,blankFragment,"hehe");
        fragmentTransaction.commit();
    }

    @Override
    public void message(String s) {
        aText.setText(s);
    }
}
